home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 1.iso / ARGONET / PD / PROGRAMMING / DESKLIBC / SOURCES.ZIP / DeskLib / !DLSources / Libraries / Str / c / MakeHex < prev    next >
Text File  |  1995-07-08  |  924b  |  28 lines

  1. /*
  2.     ####             #    #     # #
  3.     #   #            #    #       #          The FreeWare C library for 
  4.     #   #  ##   ###  #  # #     # ###             RISC OS machines
  5.     #   # #  # #     # #  #     # #  #   ___________________________________
  6.     #   # ####  ###  ##   #     # #  #                                      
  7.     #   # #        # # #  #     # #  #    Please refer to the accompanying
  8.     ####   ### ####  #  # ##### # ###    documentation for conditions of use
  9.     ________________________________________________________________________
  10.  
  11.     File:    Str.MakeHex.c
  12.     Author:  Copyright © 1994 Tim Browse
  13.     Version: 1.00 (06 Mar 1994)
  14.     Purpose: Convert a number to a hex digit character.
  15. */
  16.  
  17. #include "DeskLib:Str.h"
  18.  
  19. char Str_MakeHex(int n)
  20. {
  21.   if ((n >=0) && (n <= 9))
  22.     return ('0' + (char) n);
  23.   else if ((n >= 10) && (n <= 15))
  24.     return ('A' + (char) (n - 10));
  25.   else return '?';
  26. }
  27.  
  28.